/**
 * 
 */
package com.github.sworm.android.killer.objects;

import android.graphics.drawable.Drawable;
import android.view.View;

/**
 * This is the especific class for the enemy of type Monster
 * 
 * @author nekun
 * 
 */
public class Monster extends Enemy {

	/**
	 * @param view
	 * @param drawable
	 */
	public Monster(View view, Drawable drawable) {
		super(view, drawable);
		setvX(Math.random() * 4 - 2);
		setvY(Math.random() * 4 - 2);
		setAngle((int) (Math.random() * 360));
		setRotation((int) (Math.random() * 8 - 4));
	}

	public void incrementPosition() {
		x = x + vX;
		y = y + vY;

		logger.debug("position x: {}, y: {}", x, y);

		if (x < 0) {
			x = view.getWidth();
		}
		if (x > (view.getWidth() - width)) {
			x = 0;
		}

		if (y < 0) {
			y = view.getHeight() - height;
		}
		if (y > (view.getHeight() - height)) {
			y = 0;
		}
	}

	/*
	 * @since Mar 4, 2012 at 2:11:51 PM
	 */
	@Override
	public void doStep() {
		super.doStep();
		incrementPosition();
	}

}
